package com.example.demo.dao;

import com.example.demo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

//用户相关的数据库操作类
public interface UserDao extends JpaRepository<User,Integer> {
    //根据用户名和密码查找用户列表
    List<User> findByUsernameAndPassword(String username,String password);
    //根据用户名查找用户
    List<User> findByUsername(String user);
    //根据邮箱查找用户
    List<User> findByEmail(String email);
    @Query(value = "select * from user where nickname like concat('%',?3,'%') LIMIT ?1,?2",nativeQuery = true)
    List<Map<String, Object>> getList(int i,int limit, String nickname);
}
